//
//  EyeTestResult.swift
//  App_Common
//
//  Created by Flutter on 2021/7/27.
//

import Foundation

public class EyeTestResult {
    
    public var leftVisionIndex: Int?
    public var rightVisionIndex: Int?
    public var leftDetail: [EyeTestDetail] = []
    public var rightDetail: [EyeTestDetail] = []
    
    public init() { }
}

public extension EyeTestResult {
    func addDetail(eye:Eye, visionIndex: Int, wrong: UInt, right: UInt) {
        let detail = EyeTestDetail(visionIndex: visionIndex, right: right, wrong: wrong)
        if eye == .left {
            leftDetail.append(detail)
        }else {
            rightDetail.append(detail)
        }
    }
}


public class EyeTestDetail {
    public var right: UInt
    public var wrong: UInt
    public var visionIndex: Int
    
    public init(visionIndex:Int, right: UInt, wrong: UInt) {
        self.visionIndex = visionIndex
        self.right = right
        self.wrong = wrong
    }
}



